home *** CD-ROM | disk | FTP | other *** search
- '==========================================================
- '
- ' Module - ABOUTBOX.BAS
- '
- ' Module Prefix -
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written : #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose -
- ' Support module for TMS About box. TMS bods. Note that this is cut down version
- ' of TMS Tools code (which was written in C') and is for demonstration purposes
- ' only.
- ' The 'C' source for the DLL is NOT normally to be distributed with this demo.
- '
- ' TMS dudes/dudettes - this code may not be used without error handlers.
- '
- ' Revisions
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '==========================================================
-
-
- Option Explicit
-
-
- ' General dogs body variable.
- Global g_vDummy As Variant
-
- ' Hold resource information about application. This could be loaded into these strings
- ' by making calls to an API in the Init() routine in this module. The information would
- ' have to be appended using some sort of resource editor as the current version of Visual
- ' Basic doesn't use resources directly. The information would normally be written there
- ' by a setup program of course.
-
- Dim g_sAppName As String ' The name given to the application.
- Dim g_sVersion As String ' The name given to the version.
- Dim g_sCopyright As String ' The application's copy right information.
- Dim g_sProductID As String ' The product ID.
-
- ' STRINGTABLE ID constants - these could be used with an attached stringtable
- ' if you can add one using your own tools etc.
- Global Const g_nAppName = 1
- Global Const g_nVersion = 2
- Global Const g_nCopyright = 3
- Global Const g_nProductID = 4
-
- ' Used with Format$
- Global Const g_sYesNo = "Yes/No"
- Global Const g_sThousands = "#,##0"
-
- ' GetSystemMetrics() constants.
- Global Const SM_DEBUG = 22
- Global Const SM_SWAPBUTTON = 23
-
-
- ' Handy constant used for getting our processe's instance handle from any window
- ' in the project.
- Global Const GWW_HINSTANCE = (-6)
-
- ' Used by GetWinFlags().
- Global Const WF_CPU086 = &H40
- Global Const WF_CPU186 = &H80
- Global Const WF_CPU286 = &H2
- Global Const WF_CPU386 = &H4
- Global Const WF_CPU486 = &H8
- Global Const WF_8087 = &H400
- Global Const WF_PMODE = &H1
- Global Const WF_STANDARD = &H10
- Global Const WF_ENHANCED = &H20
- Global Const WF_LARGEFRAME = &H100
- Global Const WF_SMALLFRAME = &H200
- Global Const WF_PAGING = &H800
-
-
-
- ' ================== REAL TMS stuff =====================
-
- ' TMS DLL entry point in ABOUTDLL.DLL library. Note that instead of using 'As Any' here that
- ' you could use the 'Alias' feature in Visual Basic to make each call to bAboutCall 'type safe'.
- Declare Function bAboutCall Lib "ABOUTDLL.DLL" (ByVal nServiceID As Integer, lpStruct As Any) As Integer
-
- ' Mouse Info type.
- Const ID_MOUSE = 1
- Type VBMOUSEINFO
- nSize As Integer ' Size of this structure - same for all passed TMS structures.
- bMouseExists As Integer ' VB True if the mouse exists else false.
- nNumMouseButtons As Integer ' The number of mouse buttons on the mouse.
- nMouseCommPort As Integer ' The com port the mouse is connected to.
- End Type
-
- ' Registration info type.
- Const ID_USER = 2
- Type VBUSERINFO
- nSize As Integer
- sName As String * 255 ' Registered user's name.
- sOrg As String * 255 ' Their company/organisation.
- End Type
-
- ' Keyboard info type.
- Const ID_KYBD = 3
- Type VBKYBDINFO
- nSize As Integer
- nType As Integer ' Type of keyboard - 101 key etc.
- nCodePage As Integer ' Currently used code page, 437 etc.
- End Type
-
- ' Physical memory type.
- Const ID_PHYSMEM = 4
- Type VBPHYMEMINFO
- nSize As Integer
- nBase As Integer ' Base memory (640 Kb etc).
- nEXMS As Integer ' Extended memory.
- End Type
-
- ' Versioning type.
- Const ID_VERSION = 5
- Type VBVERINFO
- nSize As Integer
- nDOSMin As Integer ' DOS min version.
- nDOSMax As Integer ' DOS max version.
- nVBVer As Integer ' VB version.
- sWinVer As String * 10 ' Windows version.
- End Type
-
- ' Disk type.
- Const ID_DISK = 6
- Type VBDISKINFO
- nSize As Integer
- bShareInstalled As Integer ' VB True if a 'share' is installed else false.
- lTotal As Long ' Total disk space.
- lFree As Long ' Free disk space.
- nDriveNo As Integer ' Drive number, 0 = default (usually 'C:').
- End Type
-
- ' Global heap type.
- Const ID_GLOBAL = 7
- Type VBGLOBALINFO
- nSize As Integer
- lLargestFree As Long ' Largest free-block in heap.
- lTotalSize As Long ' total size of all segments in heap.
- End Type
-
- ' Linear memory type.
- Const ID_LINMEM = 8
- Type VBLINMEMINFO
- nSize As Integer
- lMaxLockPages As Long ' All obvious.
- lFreeMemory As Long
- lLargestFreeBlock As Long
- lFreeLinearSpace As Long
- lTotalMemory As Long
- lSwapPages As Long
- lTotalLinearSpace As Long
- End Type
-
- ' Used by (and defined by) TOOLHELP for SystemHeapInfo() function.
- Type SYSHEAPINFO
- lSize As Long
- nUserFreePercent As Integer
- nGDIFreePercent As Integer
- nDummy1 As Integer
- nDummy2 As Integer
- End Type
-
-
- ' Standard API functions used by this application.
- Declare Function DrawIcon Lib "USER" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal hIcon As Integer) As Integer
- Declare Function ExtractIcon Lib "Shell" (ByVal hInst As Integer, ByVal lpFileName As String, ByVal nIconID As Integer) As Integer
- Declare Function GetFreeSpace Lib "Kernel" (ByVal nFlags As Integer) As Long
- Declare Function GetModuleFileName Lib "Kernel" (ByVal hInst As Integer, ByVal lpFileName As String, ByVal nSize As Integer) As Integer
- Declare Function GetModuleHandle Lib "Kernel" (ByVal lpModuleName As String) As Integer
- Declare Function GetSystemDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer
- Declare Function GetSystemMetrics Lib "USER" (ByVal nIndex As Integer) As Integer
- Declare Function GetWindowsDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer
- Declare Function GetWinFlags Lib "Kernel" () As Long
- Declare Function GetWindowWord Lib "USER" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Integer
- Declare Function SystemHeapInfo Lib "TOOLHELP.DLL" (shi As SYSHEAPINFO) As Integer
- Declare Function WinHelp Lib "USER" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData As Long) As Integer
-
- '==========================================================
- '
- ' Function - DoCaption
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoCaption (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoCaption
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub that updates current (frm) caption, and the label controls
- ' lblCaption and lblProductID.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoCaption:
-
- ' ========== Code Starts.==========
-
-
- Dim sAppName As String
-
- ' Get App name.
- sAppName = App.EXEName
-
- ' Lower case it.
- sAppName = LCase$(sAppName)
-
- ' Remake it by using all of the name (in lower case) plus the first
- ' character of it in upper case.
- sAppName = UCase$(Left$(sAppName, 1)) & Mid$(sAppName, 2)
-
- frm!lblCaption.Caption = g_sAppName & " (" & sAppName & ")" & " " & g_sVersion & Chr$(10) & g_sCopyright
-
- frm.Caption = "About " & g_sAppName
-
- frm!lblProductID.Caption = g_sProductID
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoCaption:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoCaption", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoCaption:
-
- Exit_DoCaption:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - DoDirs
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoDirs (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoDirs
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to do 'directories' stuff.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoDirs:
-
- ' ========== Code Starts.==========
-
-
- Dim sWinDir As String
- Dim sSysDir As String
- Dim sModDir As String
- Dim sTmpDir As String
-
- ' Bit of padding.
- sWinDir = String$(255, 0)
- sSysDir = String$(255, 0)
-
- ' Get Windows and System directory.
- sWinDir = Left$(sWinDir, GetWindowsDirectory(sWinDir, Len(sWinDir)))
- sSysDir = Left$(sSysDir, GetSystemDirectory(sSysDir, Len(sSysDir)))
-
- ' TEMP dir is got from environment variable.
- sTmpDir = Environ$("TEMP")
- If Len(sTmpDir) = 0 Then sTmpDir = "None"
-
- ' Set labels. sCheckCaption() ensures that the text fits into the label control as
- ' it's easy for paths to be long man!
- frm!lblWinDir.Caption = sCheckCaption(frm, frm.lblWinDir, sWinDir)
- frm!lblSysDir.Caption = sCheckCaption(frm, frm.lblSysDir, sSysDir)
- frm!lblModDir.Caption = sCheckCaption(frm, frm.lblModDir, App.Path)
- frm!lblTEMPDir.Caption = sCheckCaption(frm, frm.lblTEMPDir, sTmpDir)
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoDirs:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoDirs", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoDirs:
-
- Exit_DoDirs:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - DoDisk
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoDisk (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoDisk
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to do disk (default) stuff.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoDisk:
-
- ' ========== Code Starts.==========
-
-
- ' Call TMS DLL for disk information. DLL functions take integer
- ' argument which specifies drive to examine.
- Dim di As VBDISKINFO
-
- di.nSize = Len(di)
-
- di.nDriveNo = 0
-
- If bAboutCall(ID_DISK, di) <> False Then
-
- frm!lblDiskTotalSpace.Caption = Format$(di.lTotal, g_sThousands) & " Bytes"
- frm!lblDiskFreeSpace.Caption = Format$(di.lFree, g_sThousands) & " Bytes"
- frm!lblShareLoaded.Caption = Format$(di.bShareInstalled, g_sYesNo)
-
- Else
- If nProcessDLLError() = True Then End
- End If
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoDisk:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoDisk", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoDisk:
-
- Exit_DoDisk:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - DoKB
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoKB (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoKB
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to do keyboard stuff.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoKB:
-
- ' ========== Code Starts.==========
-
-
- Dim ki As VBKYBDINFO
- Dim sType As String
- Dim sCodePage As String
-
- ki.nSize = Len(ki)
-
- If bAboutCall(ID_KYBD, ki) <> False Then
-
- ' Select type string from type ID.
- Select Case ki.nType
- Case 1
- sType = "IBM PC, XT or compatible (83 key)"
- Case 2
- sType = "Olivetti M24 ICO (102 key)"
- Case 3
- sType = "IBM AT (84 keys) or similar"
- Case 4
- sType = "IBM Enhanced (101 or 102 keys)"
- Case 5
- sType = "Nokia 1050"
- Case 6
- sType = "Nokia"
- Case Else
- sType = "No information"
- End Select
-
- ' Select code page string from CP ID.
- Select Case ki.nCodePage
- Case 437
- sCodePage = "Default (U.S. and most countries)"
- Case 860
- sCodePage = "Portugal"
- Case 863
- sCodePage = "French Canada"
- Case 865
- sCodePage = "Norway/Denmark"
- Case 850
- sCodePage = "International"
- Case Else
- sCodePage = "No information"
- End Select
-
- ' Set labels.
- frm!lblKBType.Caption = sType
- frm!lblActiveCP.Caption = sCodePage
-
- Else
- If nProcessDLLError() = True Then End
- End If
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoKB:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoKB", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoKB:
-
- Exit_DoKB:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - DoMem
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoMem (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoMem
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to do memory stuff (excluding local heap stuff).
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoMem:
-
- ' ========== Code Starts.==========
-
-
- Dim pmi As VBPHYMEMINFO
-
- pmi.nSize = Len(pmi)
-
- ' Do base and extended memory.
- If bAboutCall(ID_PHYSMEM, pmi) <> False Then
-
- frm!lblBaseMem.Caption = Format$(pmi.nBase, g_sThousands) & " KB"
- frm!lblExtMem.Caption = Format$(pmi.nEXMS, g_sThousands) & " KB"
-
- Else
- If nProcessDLLError() = True Then End
- End If
-
- Dim lmi As VBLINMEMINFO
-
- lmi.nSize = Len(lmi)
-
- ' Do linear (memory manager information) memory.
- If bAboutCall(ID_LINMEM, lmi) <> False Then
-
- frm!lblMaxLocablePages.Caption = Format$(lmi.lMaxLockPages, g_sThousands) & " KB"
- frm!lblFreeMemory.Caption = Format$(lmi.lFreeMemory, g_sThousands) & " KB"
- frm!lblLargestFreeBlock1.Caption = Format$(lmi.lLargestFreeBlock, g_sThousands) & " KB"
- frm!lblFreeLinearMemory.Caption = Format$(lmi.lFreeLinearSpace, g_sThousands) & " KB"
- frm!lblTotalMemory.Caption = Format$(lmi.lTotalMemory, g_sThousands) & " KB"
- frm!lblSwapFilePages.Caption = Format$(lmi.lSwapPages, g_sThousands) & " KB"
- frm!lblTotalLinearSpace.Caption = Format$(lmi.lTotalLinearSpace, g_sThousands) & " KB"
-
- Else
- If nProcessDLLError() = True Then End
- End If
-
- Dim gi As VBGLOBALINFO
-
- gi.nSize = Len(gi)
-
- ' Do global heap memory.
- If bAboutCall(ID_GLOBAL, gi) <> False Then
-
- frm!lblLargestFreeBlock.Caption = Format$(gi.lLargestFree, g_sThousands) & " KB"
- frm!lblGlobalHeapTotal.Caption = Format$(gi.lTotalSize, g_sThousands) & " KB"
-
- Else
- If nProcessDLLError() = True Then End
- End If
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoMem:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoMem", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoMem:
-
- Exit_DoMem:
-
-
- End Sub
-
- Sub DoMisc (frm As Form)
- '// Sub to do misc stuff.
- ' Update debugging kernel status caption.
- frm!lblDKL.Caption = Format$(GetSystemMetrics(SM_DEBUG), g_sYesNo)
-
- End Sub
-
- '==========================================================
- '
- ' Function - DoMouse
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoMouse (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoMouse
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to do mouse stuff.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoMouse:
-
- ' ========== Code Starts.==========
-
-
- ' Defined by TMS DLL.
- Dim mi As VBMOUSEINFO
-
- ' Init structure as required by TMS DLL.
- mi.nSize = Len(mi)
-
- ' Call TMS DLL.
- If bAboutCall(ID_MOUSE, mi) <> False Then
-
- frm!lblMPresent.Caption = Format$(mi.bMouseExists, g_sYesNo)
- frm!lblMButtons.Caption = CStr(mi.nNumMouseButtons)
- frm!lblMPort.Caption = IIf(mi.nMouseCommPort <> 0, CStr(mi.nMouseCommPort), "Bus Mouse")
-
- ' Determine whether or not Left and Right are logically reversed.
- frm!lblButtonsReversed.Caption = Format$(GetSystemMetrics(SM_SWAPBUTTON), g_sYesNo)
- Else
- If nProcessDLLError() = True Then End
- End If
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoMouse:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoMouse", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoMouse:
-
- Exit_DoMouse:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - DoRegInfo
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoRegInfo (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoRegInfo
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to get and set information on the current user.
- ' TMS DLL routine.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoRegInfo:
-
- ' ========== Code Starts.==========
-
-
- Dim tUserInfo As VBUSERINFO
-
- tUserInfo.nSize = Len(tUserInfo)
-
- ' Call TMS DLL routine.
- If bAboutCall(ID_USER, tUserInfo) <> False Then
-
- ' Set information into frm.
- frm!lblName.Caption = tUserInfo.sName
- frm!lblCompany.Caption = tUserInfo.sOrg
-
- Else
- If nProcessDLLError() = True Then End
- End If
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoRegInfo:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoRegInfo", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoRegInfo:
-
- Exit_DoRegInfo:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - DoSysResources
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoSysResources (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoSysResources
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to do system resource heap stuff.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoSysResources:
-
- ' ========== Code Starts.==========
-
-
- ' Defined by TOOLHELP.DLL.
- Dim shi As SYSHEAPINFO
-
- ' init structure.
- shi.lSize = Len(shi)
-
- ' Call TOOLHELP API.
- g_vDummy = SystemHeapInfo(shi)
-
- ' Update captions.
- frm!lblUserFree = Format$(shi.nUserFreePercent, "##") & "%"
- frm!lblGDIFree = Format$(shi.nGDIFreePercent, "##") & "%"
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoSysResources:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoSysResources", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoSysResources:
-
- Exit_DoSysResources:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - DoVersions
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoVersions (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoVersions
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to do Windows and DOS version stuff.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoVersions:
-
- ' ========== Code Starts.==========
-
-
- Dim vi As VBVERINFO
-
- vi.nSize = Len(vi)
-
- If bAboutCall(ID_VERSION, vi) <> False Then
-
- ' Visual Basic version. Note that this doesn't work too well anymore
- ' under VB4.
- frm!lblVBVersion.Caption = Format$(Hex$(vi.nVBVer), "0\.00")
-
- ' DOS version.
- frm!lblDOSVer.Caption = CStr(vi.nDOSMax) & "." & Format$(vi.nDOSMin, "00")
-
- ' Windows version.
- frm!lblWINVer.Caption = vi.sWinVer
-
- Else
- If nProcessDLLError() = True Then End
- End If
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoVersions:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoVersions", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoVersions:
-
- Exit_DoVersions:
-
-
- End Sub
-
- Sub DoWinFlags (frm As Form)
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: DoWinFlags
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub do do the GetWinFlags() stuff.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoWinFlags:
-
- ' ========== Code Starts.==========
-
-
- Dim sTemp As String
- Dim lResult As Long
-
- ' Retrieve the flags.
- lResult = GetWinFlags()
-
- ' Get processor mode.
- frm!lblProtectMode.Caption = Format$((lResult And WF_PMODE) = WF_PMODE, g_sYesNo)
-
- ' Get processor type.
- If (lResult And WF_CPU086) = WF_CPU086 Then
- sTemp = "8086"
- ElseIf (lResult And WF_CPU186) = WF_CPU186 Then
- sTemp = "80186"
- ElseIf (lResult And WF_CPU286) = WF_CPU286 Then
- sTemp = "80286"
- ElseIf (lResult And WF_CPU386) = WF_CPU386 Then
- sTemp = "80386"
- ElseIf (lResult And WF_CPU486) = WF_CPU486 Then
- sTemp = "80486 or Pentium"
- End If
-
- frm!lblProcessor.Caption = sTemp
-
- ' Get Windows' mode.
- If (lResult And WF_STANDARD) = WF_STANDARD Then
- sTemp = "Standard Mode"
- ElseIf (lResult And WF_ENHANCED) = WF_ENHANCED Then
- sTemp = "Enhanced Mode"
- End If
-
- frm!lblMode.Caption = sTemp
-
- ' Get EMS type.
- If (lResult And WF_LARGEFRAME) = WF_LARGEFRAME Then
- sTemp = "Large Frame EMS"
- ElseIf (lResult And WF_SMALLFRAME) = WF_SMALLFRAME Then
- sTemp = "Small Frame EMS"
- Else
- sTemp = "No EMS Support"
- End If
-
- frm!lblEMS.Caption = sTemp
-
- ' Get coprocessor status.
- frm!lblCoProcessor.Caption = Format$((lResult And WF_8087) = WF_8087, g_sYesNo)
-
- ' Get paging state.
- frm!lblPaging.Caption = Format$((lResult And WF_PAGING) = WF_PAGING, g_sYesNo)
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoWinFlags:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/DoWinFlags", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoWinFlags:
-
- Exit_DoWinFlags:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - Init
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - None
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub Init ()
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: Init
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sets global variables with registration information.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_Init:
-
- ' ========== Code Starts.==========
-
-
- g_sAppName = "TMS Cool-App" 'LoadResString(g_nAppName)
- g_sVersion = "Version 1.30a" 'LoadResString(g_nVersion)
- g_sCopyright = "Copyright⌐ 1994-1995 The Mandelbrot Set (Int'l) Ltd." 'LoadResString(g_nCopyright)
- g_sProductID = "1234-5678-91011" 'LoadResString(g_nProductID)
-
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_Init:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/Init", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_Init:
-
- Exit_Init:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - nProcessDLLError
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - None
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Function nProcessDLLError () As Integer
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: nProcessDLLError
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Handle errors calling into TMS DLL (if any).
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_nProcessDLLError:
-
- ' ========== Code Starts.==========
-
-
- nProcessDLLError = MsgBox("An error occurred during a call into the TMS DLL. " & "Treat error as critical?", MB_YESNO + MB_ICONQUESTION, "Error calling DLL") = IDYES
-
-
- ' ========== Code Ends .==========
-
- Exit Function
-
- ' Error handler
- Error_nProcessDLLError:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/nProcessDLLError", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_nProcessDLLError:
-
- Exit_nProcessDLLError:
-
-
- End Function
-
- '==========================================================
- '
- ' Function - sCheckCaption
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- ' cp -> Control to test.
- ' sText -> Text to fit.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Function sCheckCaption (frm As Form, cp As Control, ByVal sText As String) As String
- '==========================================================
- '
- ' Form: ABOUTBOX.BAS Procedure: sCheckCaption
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub to adjust caption text (paths in this case) so that
- ' they fit into labels.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_sCheckCaption:
-
- ' ========== Code Starts.==========
-
-
- Dim nOldMode As Integer
-
- ' Save forms old scalemode.
- nOldMode = frm.ScaleMode
-
- ' Set scale mode to pels for speed if nothing else. Note that to be more bullet
- ' proof that we shoudl update the form's font etc so that it matches.
- frm.ScaleMode = PIXELS
-
- ' Check to see if current caption text overflows the label. If it does then...
- If cp.Left + frm.TextWidth(sText) > frm.ScaleWidth Then
-
- Dim nLoop As Integer
-
- ' Step backwards through the string looking for a '\' character,
- For nLoop = Len(sText) To 1 Step -1
- If Mid$(sText, nLoop, 1) = "\" Then
- ' Found the first (starting from the end) '\'. Assume that the drive letter and
- ' the last dir name together fits. Obviously this would need checking when using
- ' long file names for example.
- sText = Left$(sText, 2) & "\...\" & Mid$(sText, nLoop + 1)
- ' Jump out of the for loop.
- Exit For
- End If
- Next
-
- End If
-
- ' Reset the form's scalemode.
- frm.ScaleMode = nOldMode
-
- ' Return the new text.
- sCheckCaption = sText
-
-
-
- ' ========== Code Ends .==========
-
- Exit Function
-
- ' Error handler
- Error_sCheckCaption:
-
- ' Call general error handler
-
- ErrorHandler "ABOUTBOX.BAS/sCheckCaption", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_sCheckCaption:
-
- Exit_sCheckCaption:
-
-
- End Function
-
-